package model

import (
	"gorm.io/gorm"
	"time"
)

type Comment struct {
	Id        uint32         `gorm:"column:id;type:int UNSIGNED;primaryKey;not null;" gorm:"id" json:"id"`
	VideoId   int32          `gorm:"column:video_id;type:int;comment:被评论视频;not null;" gorm:"video_id" json:"video_id"`          // 被评论视频
	UserId    int32          `gorm:"column:user_id;type:int;comment:评论用户ID;not null;" gorm:"user_id" json:"user_id"`             // 评论用户ID
	LikeNum   int32          `gorm:"column:like_num;type:int;comment:获赞数量;not null;default:0;" gorm:"like_num"  json:"like_num"` // 获赞数量
	Info      string         `gorm:"column:info;type:varchar(300);comment:评论内容;not null;" gorm:"info" json:"info"`               // 评论内容
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" gorm:"created_at" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" gorm:"updated_at" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" gorm:"deleted_at" json:"deleted_at"`
}

func (c Comment) TableName() string {
	return "comment"
}
